/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.risk.mapper;


import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.koron.risk.domain.LocalCheckListEntry;

public interface LocalCheckListMapper {

    LocalCheckListEntry queryByid(@Param("tableName") String tableName, @Param("id") String id);

    LocalCheckListEntry queryByCode(@Param("tableName") String tableName, @Param("code") String code);

    Integer insert(@Param("tableName") String tableName, @Param("bean") LocalCheckListEntry bean);

    Integer batchInsert(@Param("tableName") String tableName, @Param("beanList") List<LocalCheckListEntry> beanList);

    Integer update(@Param("tableName") String tableName, @Param("bean") LocalCheckListEntry bean);

    List<LocalCheckListEntry> queryByIdList(@Param("tableName") String tableName, @Param("idList") List<String> idList);

    Integer updateState(@Param("codeList") List<String> codeList, @Param("state") int state);

    Integer updateFstatusflag(@Param("idList") List<String> idList, @Param("fstatusflag") int fstatusflag);

    List<LocalCheckListEntry> getDraftList(@Param("userCode") String userCode,@Param("corpCode") String corpCode);

    Integer count(@Param("tableName") String table, @Param("name") String name,
                  @Param("corpCode") String corpCode, @Param("businessTypeId") String businessTypeId,
                  @Param("checklistEntryTypeId") String checklistEntryTypeId, @Param("state") Integer state);

    List<LocalCheckListEntry> list(@Param("tableName") String table, @Param("name") String name,
                                   @Param("corpCode") String corpCode, @Param("businessTypeId") String businessTypeId,
                                   @Param("checklistEntryTypeId") String checklistEntryTypeId, @Param("state") Integer state,
                                   @Param("start") Integer start, @Param("end") Integer end);

    List<LocalCheckListEntry> queryHstory(@Param("code") String code);
    
    Integer batchDelete(@Param("idList") List<String> idList);
    
    @Delete("delete from local_checklist_entry_history where id=#{id}")
    Integer deleteDraft(@Param("id") String id);
    
    @Update("update local_checklist_entry_history set code=#{code} where id=#{id}")
    Integer updateCode(@Param("id") String id,@Param("code") String code);
    
}
